
ac.skill('球形闪电'){
    temp = '攻击触发',
    damage_count = 7,
    model1 = [[14.mdl]],
    shot_missil = function(self,source,dest,params)
        local hero = self.owner
        local start = source:get_launch_point()
        local damage = self:dmg_get()
        self.gourp[dest] = true
        local mover = start:launch_missile(dest,self.model1,1200,0,function(mvr)
            hero:create_damage(dest,damage,self)
            self.damage_count = self.damage_count - 1
            if self.damage_count>0 then
                local point = dest:get_point()
                local target = ac.selector('unit'):range(dest,600):is_not(dest):enemy(hero):sorter(function(a,b)
                    if self.gourp[a] and self.gourp[b]==nil then
                        return false
                    end
                    if self.gourp[a]==nil and self.gourp[b] then
                        return true
                    end
                    local r1 = a:get_point() * point
                    local r2 = b:get_point() * point
                    return r1 < r2
                end):first()
                if target then
                    mvr.need_remove_mover = false
                    self:shot_missil(dest,target,{mover = mvr.mover})
                else
                    mvr.need_remove_mover = true
                end
            end
        end,params)
        mover.mover:set_scale(0.6)
    end,
    on_init = function(self,hero)
        self:gc(hero:event '单位-攻击命中'(function()
            self:set_cd(self:get_cd() - 0.1)
        end))
    end,
    on_run = function(self,hero,target)
        local count = 1 + math.floor(hero:get('多重数量') / 2)
        for a=1,count do
            local temp = self:create_cast()
            local target = ac.selector('unit'):range(target,600):enemy(hero):random()
            temp.damage_count = 5 +  math.floor(hero:get('弹射次数') / 2)
            temp.gourp = {}
            temp:shot_missil(hero,target)
        end
    end,
}